Component({
    data: {
        navIndex: 0,
        data: [],
    },
    properties: {
        data: {
            type: Array,
            value: [],
            observer: function (val) {
                this.setData({
                    data: val
                });
            }
        },
        index: {
            type: Number,
            value: 0,
            observer: function (val) {
                let that = this;
                that.setData({
                    navIndex: val
                });
            }
        }
    },
    lifetimes: {
        attached() { },
        detached() { },
    },
    methods: {
        //切换事件
        textEvent(e) {
            const index = e.currentTarget.dataset.index;
            const item = e.currentTarget.dataset.item;
            this.triggerEvent("navTap", { data: item, index: index })
        },
        //右边图标点击事件
        open(e) {
            this.triggerEvent("open")
        },
        //搜索点击事件
        search(e) {
            wx.navigateTo({
                url: '/pagesShouYe/pages/search/index',
            })
        },
    }
})